﻿namespace EFS.RC.SupervisorCentral.Controls
{
	/// <summary>
	/// Interaction logic for ThresholdsPhones.xaml
	/// </summary>
	public partial class ThresholdsPhones : System.Windows.Window
	{
		public System.String SelectedPhone = null;

		public ThresholdsPhones(System.Collections.Generic.IEnumerable<System.String> availablePhones = null)
		{
			InitializeComponent();

			// load frmom available
			if (null != availablePhones)
			{
				// filter phones
				System.String filterPhonesValue = EFS.RC.SupervisorCentral.Common.Config.AppSettings.FilterPhones;

				foreach (System.String phone in availablePhones)
				{
					if (!EFS.Common.Verify.String(filterPhonesValue) || filterPhonesValue.IndexOf(phone) >= 0)
					{
						listBox1.Items.Add(phone);
					}
					else
					{
						listBox1.Items.Add(phone);
					}
				}
			}
		}

		private void listBox1_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
		{
			SelectedPhone = listBox1.SelectedValue as System.String;
			Close();
		}

		private void button1_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			Close();
		}
	}
}